constant kAppSymbol := '|sendCard:PIEDTS|;
constant kMyItemIDRoutingSymbol := '|ID:sendCard:PIEDTS|;
constant kMyTotalItemsRoutingSymbol := '|total:sendCard:PIEDTS|;


installScript := func(partFrame)
begin
   routing.(kAppSymbol) := partFrame.theForm.myRoutingFrame ;
end;

removeScript := func(partFrame)
begin
   RemoveSlot(routing, kAppSymbol);
end;
// ---- End Project Data ----


// ---- File main.t ----

// Before Script for "myBase"
// Copyright 1993-1994 Apple Computer. All rights reserved.

myBase :=
   {viewBounds: {left: -12, top: 38, right: 176, bottom: 122},
    appSymbol: kAppSymbol,
    myRoutingFrame:
      {
         // very simple routing frame, just doing beaming
      
         beam: {
            title: "Beam Em!",
            routeForm: 'zapSlip
         }
      },
    setupRoutingSlip:
      func(fields)
      begin
         // message sent after the user hits Beam in zapSlip
      
         // set the recieving applicaiton to be the card file
         fields.appSymbol := 'cardFile;
      
         fields.(kMyItemIDRoutingSymbol) := 1 ;
      
         // Now send over up to 2 more cards as seperate beams
         local num := 0 ; // the first beam
         local myFieldsArray := [] ;
         local temp ;
      
         while myCursor:Next() and (num < 3) do
         begin
            num := num + 1 ;
            // make a clone of the fields variable. This is the
            // data structure that is sent over on the beam
            temp := TotalClone(fields);
      
            // the putAway script on the other side actually
            // looks at the body slot not the target slot
            // so put the real data into the body slot
            temp.body := myCursor:Entry();
      
            // now add some information for synchronization
            // i.e., this is the nth item.
            temp.(kMyItemIDRoutingSymbol) := num ;
      
            // finally, add the item to the array of items that
            // will get jammed into the outbox
            AddArraySlot(myFieldsArray, temp) ;
         end;
      
      
         // now post the items to the outbox
         foreach item in myFieldsArray do
         begin
            // add more synchronization information, in this
            // case the total number of items that are in
            // the 'beam'
            item.(kMyTotalItemsRoutingSymbol) := num ;
      
            // set the title of the item for the out/inbox
            item.title := "Send Card" && item.(kMyItemIDRoutingSymbol) && "of" && num ;
      
            // jam it in the outbox
            outbox:PostItem(item); // submit
         end;
      
      
         fields.(kMyItemIDRoutingSymbol) := num ;
         // setup the title that will show in the
         // outbox item. NOTE: the outbox does not wrap
         // it will let you overwrite the line below
         fields.title := "Send Card 1 of" && num;
      end,
    title: "Send Card",
    viewSetupDoneScript:
      func()
      begin
         // setup the routing information
       
         myCursor := Query(GetUnionSoup(ROM_cardfilesoupname),
                           {type: 'index, indexPath: 'sortOn}) ;
      
         // the target data for the route, this would normally be
         // a cursor Entry. If you want to do mailing, beaming
         // deleting, ... this MUST be a cursor entry.
         self.target :=  myCursor:Entry();
         
         // view that gets the routing messages
         self.targetView := self ;
      end,
    myCursor: nil,
    viewQuitScript:
      func()
      begin
      myCursor := nil;      // you must nil out your cursor in your quit script or else you can
      					// get errors relating to bad reference when you try to take out the card.
      					// errors like this are very difficult to track down, so nil out your cursors!
      end,
    _proto: protoFloatNGo,
    debug: "myBase"
   };

_view000 := /* child of myBase */
   {viewBounds: {left: 6, top: 8, right: 78, bottom: 24}, _proto: protoTitle};



_view001 := /* child of myBase */
   {viewJustify: 166,
    viewBounds: {left: -44, top: -20, right: -27, bottom: -7},
    _proto: protoActionButton
   };







// ---- Beginning of section for non used Layout files ----

// End of output